<!-- 获取组织机构列表 -->
<template>
<el-cascader v-model="selectedOptions" :options="options"
             :props="propsCascader"
             ref="roadCascader" clearable
             :placeholder="placeholder">
</el-cascader>
</template>

<script>
export default {
  props: {
    placeholder: {
      type: String,
      default: '请选择'
    },
    options:{
      type:Array,
      default: ()=>{
        return []
      }
    }
  },
  computed: {
    selectedOptions: {
      get (val) {
        if (val.$attrs.value) {
          return val.$attrs.value.split('-') || []
        } else {
          return []
        }
      },
      set (val) {
        this.newOptions = val.join('-')
        this.$emit('input', this.newOptions)
      }
    }
  },
  methods: {
  },
  data () {
    return {
      test: [],
      newOptions: '',
      //路线路段选择器配置
      propsCascader: {
        label: 'name',
        value: 'id',
        children:'roadSectionList',
      },

    }
  },
}
</script>

<style>
</style>
